<!DOCTYPE html>
<html lang="en">
<head>
    <title></title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <script src="https://file.ggxqce.com/web/vue.min.js"></script>
    <!--定义站点的icon图标，跟网页中的图片有本质上的区别，icon是显示在地址栏最前面的一个16*16的小图标-->
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!--上传图片插件-->
    <link rel="stylesheet" href="/dist/plugins/webuploader-0.1.5/webuploader.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=f5a12a1d">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <link rel="stylesheet" href="/dist/css/oaApp.css">
    <link rel="stylesheet" href="/dist/css/oa-app.css">
    <style>
        [v-cloak] {
            display: none;
        }

        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            font-size: 12px;
        }

        body {
            margin: 1px;
            background: white;
        }

        .progressobj {
            display: flex;
            justify-content: space-between;
            height: 20px;
        }

        .progressobj .delfile {
            float: right;
            margin-right: 10px;
        }

        table {
            border-spacing: 0;
            border-collapse: collapse;
            display: table;
        }

        table.text-center, table.text-center td, table.text-center th {
            text-align: center;
            font-size: 12px;
        }

        .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
            border: 1px solid #cbcbcd;
            font-weight: normal;
            height: 24px;
        }

        table th {
            background: #f8f8f8;
        }

        .table-bordered {
            border: 1px solid #cbcbcd;
        }

        .table {
            width: 100%;
            max-width: 100%;
        }

        .hidden {
            display: none;
        }

        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 24px;
            line-height: 24px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .mScrollBox {
            float: left;
            position: relative;
            overflow: hidden;
        }

        .infoReport {
            text-align: center;
            margin: 0;
            margin-bottom: 10px;
        }

        .moduleName {
            height: 20px;
            line-height: 20px;
            background: #f8f8f8;
            font-weight: bold;
            font-size: 14px;
        }

        .toggleDiv div {
            width: 50%;
            float: left;
            text-align: center;
        }

        .toggleDiv div.active {
            border-bottom: 2px solid #2289ee;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .text-center {
            text-align: center;
        }

        .td-title {
            background-color: #F5F5F5;
        }

        element.style {
            width: 16%;
        }

        .table-detail {
            width: 100%;
            border-left: 1px solid #e8e8e9;
            border-top: 1px solid #e8e8e9;
            border-spacing: 0;
            /*table-layout: fixed;*/
        }

        .table-detail .td-title {
            background-color: #f5f5f5;
        }

        .table-detail td {
            border-right: 1px solid #e8e8e9;
            border-bottom: 1px solid #e8e8e9;
            /* padding-left: 0px !important;*/
            padding-right: 0px !important;
            padding-top: 0px !important;
            padding-bottom: 0px !important;
            height: 29px;
            /*line-height: 29px;*/
            text-align: center;
            position: relative;
            overflow: hidden;
            word-wrap: break-word;
        }

        .table-detail td input {
            display: inline-block;
            outline: none;
            border: 0;
            /*background: #F8F8F8;*/
            padding: 0;
            margin: 0;
            width: 93px;
            text-align: center;
            color: #2a8cec;
        }

        /* .table-detail td span{
             color: #2a8cec;
         }*/
        .table-detail td textarea, .table-detail td select {
            width: 100%;
            height: 100%;
            line-height: 100%;
            padding-top: 20px;
            padding-left: 6px;
            outline: none;
            resize: none;
            border: none;
            color: #2a8cec;
        }

        .table-detail td select {
            padding-top: 0px;
            padding-left: 0px;
            width: auto;
            border: none;
            color: #2a8cec;
        }

        .btn {
            border-radius: 3px;
            -webkit-box-shadow: none;
            box-shadow: none;
            border: 1px solid transparent;
        }

        .btn-primary {
            background-color: #228bee;
            border-color: #127ee5;
            color: #fff;
        }

        .btn-group-sm > .btn, .btn-sm {
            padding: 5px 10px;
            font-size: 12px;
            line-height: 1.5;
            border-radius: 3px;

        }

        .model-picker-input {
            opacity: 0 !important;
            top: -9999px;
            left: -9999px;
            position: absolute;
        }

        .model-picker-span {
            position: relative;
            display: block;
            outline: 0;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            border-bottom: 1px solid #ccc;
            background-color: #fff;
            color: #ccc;
            cursor: pointer;
        }

        .model-picker-span > .placeholder {
            color: #aaa;
        }

        .model-picker-span > .arrow {
            position: absolute;
            top: 50%;
            right: 8px;
            width: 10px;
            margin-top: -3px;
            height: 5px;
            background: url(../images/drop-arrow.png) -10px -25px no-repeat;
        }

        .model-picker-span.focus,
        .model-picker-span.open {
            border-bottom-color: #46A4FF;
        }

        .model-picker-span.open > .arrow {
            background-position: -10px -10px;
        }

        .model-picker-span > .title > span {
            color: #333;
            padding: 5px;
            border-radius: 3px;
        }

        .model-picker-span > .title > span:hover {
            background-color: #f1f8ff;
        }

        .model-picker-dropdown {
            position: absolute;
            width: 315px;
            left: -9999px;
            top: -9999px;
            outline: 0;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            z-index: 999999;
            display: none;
            min-width: 330px;
            margin-bottom: 20px;
            margin-top: 10px;
        }

        .model-select-wrap {
            width: 75%;
            box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
        }

        .model-select-tab {
            border-bottom: 1px solid #ccc;
            background: #f5f5f5;
            font-size: 13px;
        }

        .model-select-tab > a {
            display: inline-block;
            padding: 4px 20px;
            border-left: 1px solid #ccc;
            border-bottom: 1px solid transparent;
            color: #4D4D4D;
            text-align: center;
            outline: 0;
            text-decoration: none;
            cursor: pointer;
            font-size: 14px;
            margin-bottom: -1px;
        }

        .model-select-tab > a.active {
            background: #fff;
            border-bottom: 1px solid #fff;
            color: #46A4FF;
        }

        .model-select-tab > a:first-child {
            border-left: none;
        }

        .model-select-tab > a:last-child.active {
            border-right: 1px solid #ccc;
        }

        .model-select-content {
            width: 100%;
            min-height: 10px;
            background-color: #fff;
            /*padding: 5px 5px;*/
        }

        .model-select {
            font-size: 13px;
        }

        .model-select dl {
            line-height: 2;
            clear: both;
            padding: 3px 0;
            margin: 0;
        }

        .model-select dt {
            position: absolute;
            width: 2.5em;
            font-weight: 500;
            text-align: right;
            line-height: 2;
        }

        .model-select dd {
            margin-left: 0;
            line-height: 2;
        }

        .model-select.province dd {
            margin-left: 3em;
        }

        .model-select a {
            display: inline-block;
            padding: 0 10px;
            outline: 0;
            text-decoration: none;
            white-space: nowrap;
            margin-right: 2px;
            text-decoration: none;
            color: #333;
            cursor: pointer;
        }

        .model-select a:hover,
        .model-select a:focus {
            background-color: #f1f8ff;
            border-radius: 2px;
            color: #46A4FF;
        }

        .model-select a.active {
            background-color: #46A4FF;
            color: #fff;
            border-radius: 2px;
        }

        td {
            color: #2a8cec;
        }

        td.td-title, td select, td .filename, td.td-module {
            color: #333;
        }

        td.td-value, span {
            padding-left: 4px;
        }

        td.td-value {
            background-color: white;
        }

        .user {
            height: 30px;
            line-height: 30px;
            max-height: 30px;
            float: left;
            text-align: left;
            /*min-width: 32px;*/
            padding-left: 1px;
            overflow: hidden;
            cursor: pointer;
        }

        .user:hover {
            background-color: #cfd4d1;
        }

        td .lookFj {
            /*width: 100%;*/
            color: #2a8cec;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            position: relative;
            cursor: pointer;
            background: none;
            padding-left: 6px;
            text-align: left;
            height: 100%;
            width: 200px;
        }

        .fujian {
            /*display: inline-block;*/
            cursor: pointer;
            padding-left: 19px;
            background: url(/dist/img/fujian.png) no-repeat 6px center;
            color: #2a8cec;
        }

        .lineTwo span {
            line-height: 16px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            text-align: left;
        }

        .biTian {
            position: absolute;
            color: #000;
            margin-left: -10px;
            margin-top: 2px;
        }

        .touBtn {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 50px;
            line-height: 50px;
            background: #2a8cec;
            color: #fff;
            text-align: center;
            font-weight: bold;
            font-size: 16px;
            margin: 0 auto;
            z-index: 11111;
        }

        .touBtn div {
            float: left;
            width: 50%;
            box-sizing: border-box;
            font-size: 16px;
        }

        .touBtn .line {
            height: 24px;
            width: 1px;
            background: #fff;
            position: absolute;
            left: 50%;
            top: 13px;
        }
        .fj-tanzhongStyle .name{
            height: 27px;
            line-height: 27px;
        }

    </style>
</head>
<body>
<div class="oaLoad">
    <div class="loadGif" id="areaProgress"></div>
</div>
<iframe id="ifAttach" style="display:none"></iframe>
<section class="" id="app" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <div class="center" style="overflow:auto;overflow-x:hidden;padding-bottom: 51px;">
        <table class="table-detail">
            <tr>
                <td class="td-title" colspan="4"
                    style="text-align: center;background-color: #d3e8fd;">基本信息
                </td>
            </tr>
            <tr>
                <td class="td-title" style="width:20%;">申请人</td>
                <td clsss="td-value" style="width:30%;text-align: left;background-color: white">
                    <span>{{tmpEvent.main.createUserName}}</span></td>
                <td class="td-title" style="width: 20%;">申请时间</td>
                <td clsss="td-value" style="width:30%;text-align: left;background-color: white">
                    <span>{{tmpEvent.main.createTime}}</span>
                </td>
            </tr>
            <tr>
                <td class="td-title">事项类型</td>
                <td clsss="td-value" style="text-align: left;background-color: white;">
                    <span>{{tmpEvent.main.type}}</span>
                </td>
                <td class="td-title">部门</td>
                <td clsss="td-value" style="text-align: left;background-color: white">
                    <span>{{tmpEvent.main.orgName}}</span>
                </td>
            </tr>
            <template v-if="tmpEvent.main.type == '新机注册'">
                <tr>
                    <td class="td-title">客户姓名</td>
                    <td clsss="td-value" style="text-align: left;background-color: white" class="lineOne"><span >{{tmpEvent.main.customerName}}</span>
                    </td>
                    <td class="td-title">客户电话</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"><span>{{tmpEvent.main.customerTel}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">客户地址</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"
                        colspan="3"><span>{{tmpEvent.main.provinceName}}-{{tmpEvent.main.cityName}}-{{tmpEvent.main.countyName}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">机型</td>
                    <td clsss="td-value" style="text-align: left;background-color: white" colspan="3"><span>{{tmpEvent.main.modelName}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">序列号</td>
                    <td clsss="td-value" style="text-align: left;background-color: white" colspan="3"><span>{{tmpEvent.main.sequence}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">交机状态</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"><span>{{Flag2BuyType(tmpEvent.main.deliveryState)}}</span>
                    </td>
                    <td class="td-title">交机日期</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"><span>{{tmpEvent.main.deliveryDate}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">购买方式</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"
                        colspan="3"><span>{{tmpEvent.main.buyType}}</span></td>
                </tr>
            </template>

            <!--商务条件字段-->
            <template v-if="tmpEvent.main.type == '商务条件申请'">
                <tr>
                    <td class="td-title">客户姓名</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"><span class="lineOne">{{tmpEvent.main.customerName}}</span>
                    </td>
                    <td class="td-title">机型</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"><span>{{tmpEvent.main.modelName}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">区域经理</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"><span>{{tmpEvent.main.regionManagerName}}</span>
                    </td>
                    <td class="td-title">大区经理</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"><span>{{tmpEvent.main.bigRegionManagerName}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">区域总监</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"><span>{{tmpEvent.main.regionDirectorName}}</span>
                    </td>
                    <td class="td-title">区域支持</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"><span>{{tmpEvent.main.regionSupportName}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">厂家支持</td>
                    <td clsss="td-value" style="text-align: left;background-color: white"><span>{{tmpEvent.main.manufactorSupportName}}</span>
                    </td>
                    <td class="td-title"></td>
                    <td clsss="td-value" style="text-align: left;background-color: white"></td>
                </tr>
            </template>
            <!--<tr>-->
            <!--<td class="td-title">主题</td>-->
            <!--<td colspan="3" clsss="td-value" style="text-align: left;background-color: white;padding-left: 6px;">-->
            <!--{{tmpEvent.main.title}}-->
            <!--</td>-->
            <!--</tr>-->
            <tr>
                <td class="td-title" style="height: 68px;">详细描述</td>
                <td colspan="3" style="text-align: left;vertical-align: top;padding:4px !important;line-height:18px;">
                    <div>{{tmpEvent.main.description}}</div>
                </td>
            </tr>

            <tr>
                <td class="td-title" style="width:16%;">附件</td>
                <td  colspan="3">
                    <div style="width: 98%;    margin-left: 1%;" class="fj-tanzhongStyle" v-for="(attach,i) in tmpEvent.attaches" v-if="attach.name!=''"  v-on:click="look(attach.url)">
                        <b :class="fjStyle(attach.name)"></b>
                        <div class="name" :title="attach.name" :style="pageType=='look'?'':''"
                             :title="attach.name" >
                            {{attach.name}}
                        </div>
                    </div>


                    <div v-if="tmpEvent.attaches.length==0" style="text-align: left;">
                        <span class="sp-value">无</span>
                    </div>

                </td>
            </tr>
        </table>
        <table class="table-detail">
            <tr>
                <td class="td-title" colspan="4"
                    style="text-align: center;background-color: #d3e8fd;">审批进度
                </td>
            </tr>
            <tr>
                <td class="td-title" style="width: 67px;">审核人</td>
                <td class="td-title" style="width: 80px;">审核状态</td>
                <td class="td-title" style="width: 100px;">审核时间</td>
                <td class="td-title">审核意见</td>
            </tr>
            <tr v-for="(item,i) in tmpEvent.auditors">
                <td style="text-align: center;">
                    <span style="padding: 0px;" class="oa-name">{{item.auditorName}}</span>
                </td>
                <td style="text-align: center;">
                    <span v-if="item.auditFlag==0" style="color:red;padding: 0px;">{{convertAuditFlagToName(item.auditFlag)}}</span>
                    <span v-else
                          style="padding: 0px;">{{convertAuditFlagToName(item.auditFlag)}}</span>
                </td>
                <td style="text-align: center;">
                    <span v-if="item.auditTime"
                          style="padding: 0px;">{{formatDate(item.auditTime)}}</span>
                    <span v-else style="padding: 0px;"></span>
                </td>
                <td style="padding-left: 1px;text-align: left !important;" class="lineOne">
                    <span style="padding: -2px;">{{item.auditAdvise}}</span>
                </td>
            </tr>
            <!--<tr>-->
                <!--<td class="td-title" style="">抄送人</td>-->
                <!--<td colspan="3">-->
                    <!--<div id="user" style="padding-left:4px;padding-top:2px;">-->
                        <!--<div v-for="(user,i) in tmpEvent.copiers" class="user" style="height:20px;line-height:20px;">-->
                            <!--{{user.copyPersonName}};-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</td>-->
            <!--</tr>-->
        </table>
        <!--抄送人-->
        <table class="table-detail" style="border-top-width:0px;margin-bottom: 2px;">
            <tr>
                <td class="td-title" style="width: 25%;">抄送人</td>
                <td colspan="5">
                    <div id="user" style="padding-left:4px;padding-top:2px;">
                        <div v-for="(user,i) in tmpEvent.copiers" class="user" style="height:20px;line-height:20px;">
                            {{user.copyPersonName}};
                        </div>
                    </div>
                </td>
            </tr>
            <tr v-if="tmpEvent.main.copierReturnReason">
                <td class="td-title" style="width:25%;">驳回原因</td>
                <td colspan="5" style="text-align:left;">
                    <span class="sp-value">{{tmpEvent.main.copierReturnReason}}</span>
                </td>
            </tr>
        </table>
        <!--历史驳回记录-->
        <table class="table-detail" style="width: 100%;"
               v-if="tmpEvent.historys && tmpEvent.historys.length>0">
            <tr>
                <td class="td-title" colspan="4"
                    style="text-align: center;background-color: #d3e8fd;">历史驳回记录
                </td>
            </tr>
            <template v-for="(item,i) in tmpEvent.historys">
                <tr>
                    <td class="td-title" style="width: 20%;"><i></i>审核人</td>
                    <td style="width:30%;text-align: left;background-color: white"><span>{{item.auditorName}}</span>
                    </td>
                    <td class="td-title" style="width:20%;line-height: 20px;">审核日期</td>
                    <td style="width:30%;text-align: left;background-color: white"><span>{{formatDate(item.auditTime)}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title"> 驳回原因</td>
                    <td class="td-value" colspan="3" style="text-align: left;background-color: white">
                        <div style="padding-left: 4px;line-height: 20px;">{{item.auditAdvise}}</div>
                    </td>
                </tr>
            </template>
        </table>
    </div>
    <!--<div v-if="showAuditReturnBtn" class="south no-print"-->
    <!--style="height:50px;line-height:50px;text-align:center;bottom:0;position: fixed;width: 100%;">-->
    <!--<div value="" class="" @click="showConfirmDialog()"-->
    <!--style="background-color: #228bee;margin-left:-1px;width: 50%;float:left;color:#fff;font-size: 16px;position: relative">-->
    <!--<span style="position: absolute;width:1px;height:14px;font-size:20px;right:-1px;top:-3px;">|</span>-->
    <!--<strong>通过</strong>-->
    <!--</div>-->
    <!--<div value="" class="" @click="showReturnDialog()"-->
    <!--style="background-color: #228bee;width: 50%;float:left;color:#fff;font-size: 16px"><strong>驳回</strong>-->
    <!--</div>-->
    <!--</div>-->

    <div class="touBtn" v-if="showAuditReturnBtn">
        <div class="touTa" @click="showConfirmDialog()">通过</div>
        <div class="noTouTa" @click="showReturnDialog()">驳回</div>
        <i class="line"></i>
    </div>

    <!--驳回重新编辑-->
    <div class="touBtn" v-if="tmpEvent.main.auditFlag == '2' && tmpEvent.main.createUserId ==  getUrlParamObj().userId">
        <div class="touTa" style="width: 100%;" @click="reEdit()">重新编辑</div>
    </div>
    <!--抄送人驳回-->
    <div class="touBtn" v-if="showCopierReturn()">
        <div class="touTa" style="width: 100%;" @click="showCopyReturnDialog()">驳回</div>
    </div>

</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="/dist/plugins/scroll/myScroll.js"></script>
<!--框架已定义 JS-->
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/commonService.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/changeMoneyToChinese.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script>
    $(function () {
        $("body").on("click", ".selectModel", function (e) {
            if ($(".model-picker-dropdown").is(":hidden")) {
                $(".model-picker-dropdown").css({
                    "width": $(this).outerWidth() + "px",
                    "left": $(this).offset().left,
                    "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                }).show();
                e.stopPropagation();
            } else {
                $(".model-picker-dropdown").hide();
            }
        });
        $("body").on("click", ".model-select-tab a", function (e) {
            $(this).parent().find("a").removeClass("active");
            $(this).addClass("active");
            var boxName = $(this).attr("data-count");
            $(".model-select").hide();
            $(".model-select-content" + " ." + boxName).show();
        });
        $("body").on("click", ".model-select  a", function (e) {
            if ($(this).hasClass("active")) {
                return false;
            }
            $(this).parent().find("a").removeClass("active");
            var id = $(this).attr("attr-id");
            $(this).addClass("active");
            if ($(this).parents(".model-select").hasClass("type")) {
                $(".model-select-tab a").removeClass("active");
                $(".model-select-tab a[data-count=brand]").addClass("active");
                $(".model-select").hide();
                app.getBrand(id);
                $(".model-select-content .brand").show();

            } else if ($(this).parents(".model-select").hasClass("brand")) {
                $(".model-select-tab a").removeClass("active");
                var id = $(this).attr("attr-id");
                $(".model-select-tab a[data-count=model]").addClass("active");
                $(".model-select").hide();
                app.getModel(id);
                $(".model-select-content .model").show();
            } else {
                app.modelName = $(this).text();
                app.modelId = id;
                $(".model-picker-dropdown").hide();
            }
        })
        $("body").on("click", ".model-picker-dropdown", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".model-picker-dropdown").hide();
        });
    });
</script>
<script>
    $.ajaxSetup({
        global: true,
        type: "POST",
        cache: false,
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        beforeSend: function () {
        },
        complete: function () {

        },
        error: function (e) {
            alert('error' + e.responseText);
        }
    });
    $.extend($.wyui, {
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {

                },
                complete: function () {
                    setTimeout(function () {
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    alert(url + e.responseText);
                }
            });
        },
    });

    function NewDate(str) {
        if (!str) {
            return 0;
        }
        arr = str.split(" ");
        d = arr[0].split("-");
        t = arr[1].split(":");
        var date = new Date();
        date.setUTCFullYear(d[0], d[1] - 1, d[2]);
        date.setUTCHours(t[0] - 8, t[1], t[2], 0);
        return date;
    }
</script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    //     var api = frameElement.api, W = api.opener;
    function refresh() {
        //app.getById();
        setTimeout(function () {
            //这个可以关闭安卓系统的手机
            document.addEventListener('WeixinJSBridgeReady', function () {
                WeixinJSBridge.call('closeWindow');
            }, false);
            //这个可以关闭ios系统的手机
            WeixinJSBridge.call('closeWindow');
        }, 100)
    }

    var app = new Vue({
        el: '#app',
        data: {
            isGo:true,//是否可执行ajax
            showAuditReturnBtn: false,
            pageType: '',
            userId: '',
            userInfo:{},
            urlParams: null,
            tmpEvent: {
                main: {
                    id: '',
                    type: '',
                    title: '',
                    orgName: '',
                    regionName: '',
                    description: '',
                    createUserId: getUrlParamObj().userId,
                    auditFlag: '-1',
                    createUserName: '',
                    companyId: '',
                    createTime: '',
                    currentAuditorId: '',
                    currentAuditorName: '',
                    modelId: '',
                    modelName: '',
                    sequence: '',
                    customerName: '',
                    customerTel: '',
                    customerAddress: '',
                    deliveryState: -1,
                    deliveryDate: '',
                    buyType: '',
                    provinceName: '',
                    cityName: '',
                    countyName: '',
                    regionManagerName:'',
                    regionManagerId : '',
                    regionManagerName : '',
                    bigRegionManagerId : '',
                    bigRegionManagerName : '',
                    regionDirectorId : '',
                    regionDirectorName : '',
                    regionSupportId : '',
                    regionSupportName : '',
                    manufactorSupportId : '',
                    manufactorSupportName : ''
                },
                uploader: null,
                copiers: [],
                auditors: [],
                historys: [],
                attaches: []//附件

            }
        },
        methods: {
            showCopierReturn: function () {
                if (this.tmpEvent.main.auditFlag != '-1' && this.tmpEvent.main.auditFlag != '2') {
                    var copierIds = new Array();
                    for (var i = 0; i < this.tmpEvent.copiers.length; i++) {
                        copierIds.push(this.tmpEvent.copiers[i].copyPersonId);
                    }
                    return $.inArray(getUrlParamObj().userId, copierIds) > -1;
                }
                return false;
            },
            convertToChinese: function (item) {
                return changeMoneyToChinese(item);
            },
            Flag2BuyType: function (flage) {
                if (flage == "0") return "未交机";
                if (flage == "1") return "已交机";
            },
            formatDateNew: function (now) {
                var d = new Date(now);
                var hour = d.getHours();
                var minute = d.getMinutes();
                var second = d.getSeconds();
                var month = d.getMonth() + 1
                var day = d.getDate();
                if (hour < 10) {
                    hour = "0" + hour;
                }
                if (minute < 10) {
                    minute = "0" + minute;
                }
                if (month < 10) {
                    month = "0" + month;
                }
                if (day < 10) {
                    day = "0" + day;
                }
//                return month + "-" + day + " " + hour + ":" + minute;
                return month + "月" + day + "日" + " " + hour + ":" + minute;
            },
            formatDate: function(now) {
                return new Date(now).Format(TimeFormat.middle)
            },
            showDatePicker: function (e, item) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        //that.business.main.dealTime = dp.cal.getNewDateStr();
                        return true;
                    }
                });
                $(e.target).blur();
            },
            deleteFile: function (i) {
                this.tmpEvent.attaches.splice(i, 1);
            },
            download: function (attachId, fileName) {
                downloadFile(attachId, fileName)
                return false;
            },
            fjStyle: function (fjName) {
                if (fjName) {
                    var type = fjName.substring(fjName.lastIndexOf('.') + 1);
                    return 'img fj-' + type
                }
                return 'img'
            },
            showConfirmDialog: function () {
                if (getUrlParamObj().platform != 'android') {
                    //微信使用
                    if (confirm("确认要通过吗?")) {
                        this.applyAudit('1', "同意！")
                    }
                } else {
                    //app使用
                    var that = this
                    var param = {
                        title: "提示",
                        content: "确定要通过吗？",
                        cancelText: "取消",
                        confirmText: "确定",
                        showCancel: true,
                        cancelable: false
                    }
                    JSBridge.call(UI, 'showDialog', param, function (res) {
                        if (res.sendData.data == '确定') {
                            that.applyAudit('1', "同意！")
                        }
                    })
                }
            },
            showReturnDialog: function () {
                if (getUrlParamObj().platform == 'android') {
                    var that = this
                    var param = {
                        data: '1',
                        title: "请输入驳回原因",
                        hint: "请输入",
                        tipMsg: "请输入驳回内容",
                        confirmText: "确认",
                        cancelable: true
                    }
                    JSBridge.call(UI, 'showInputDialog', param, function (res) {
                        //驳回内容
                        if (res.sendData.content) {
                            var content = res.sendData.content;
                            JSBridge.call(UI, 'showLoading', {})
                                $.wyui.postMethod(urlConfig.apply.tmpevent.applyAudit, {
                                    id: getUrlParamObj().id,
                                    userId: that.userId,
                                    auditFlag: '2',
                                    advise: content
                                }, function () {
                                    $.wyui.postMethod(urlConfig.system.message.setMessageReadFlag, {
                                        receiverId: getUrlParamObj().receiverId,
                                        flag: '1'
                                    }, function (r) {
                                        console.log(r)
                                        JSBridge.call(UI, 'hideLoading', {})
                                        JSBridge.call(UI, 'showToast', {title: '驳回成功'})
                                        JSBridge.call(ROUTER, 'navigateBack', {backRefresh: true})
                                    }, true);
                                });
                        }
                    })
                } else {
                    $.dialog({
                        content: 'url:copierReturnReasonApp.html?id=' + getUrlParamObj().id + "&currentAuditorId=" + this.userId + "&receiverId=" + getUrlParamObj().receiverId,
                        title: '驳回',
                        width: 300,
                        height: 250,
                        max: false,
                        min: false,
                        lock: true
                    });
                }
            },
            showCopyReturnDialog: function () {
                var that = this
                var param = {
                    data: '1',
                    title: "请输入驳回原因",
                    hint: "请输入",
                    tipMsg: "请输入驳回内容",
                    confirmText: "确认",
                    cancelable: true
                }
                JSBridge.call(UI, 'showInputDialog', param, function (res) {
                    //驳回内容
                    if (res.sendData.content) {
                        var content = res.sendData.content;
                        JSBridge.call(UI, 'showLoading', {})
                            $.wyui.postMethod(urlConfig.apply.tmpevent.copierReturn, {
                                id: getUrlParamObj().id,
                                copierReturnReason: userInfo.name + "(原因：" + content + ")"
                            }, function (result) {
                                JSBridge.call(UI, 'hideLoading', {})
                                JSBridge.call(UI, 'showToast', {title: '驳回成功'})
                                JSBridge.call(ROUTER, 'navigateBack', {backRefresh: true})
                            }, true);
                    }
                })
            },
            applyAudit: function (auditFlag, advise) {
                if (getUrlParamObj().platform == 'android') {
                    JSBridge.call(UI, 'showLoading', {})
                }
                if(this.isGo){
                    this.isGo = false;
                    $.wyui.postMethod(urlConfig.apply.tmpevent.applyAudit, {
                        id: getUrlParamObj().id,
                        userId: this.userId,
                        auditFlag: auditFlag,
                        advise: advise
                    }, function () {
                        $.wyui.postMethod(urlConfig.system.message.setMessageReadFlag, {
                            receiverId: getUrlParamObj().receiverId,
                            flag: '1'
                        }, function (r) {
                            if (getUrlParamObj().platform == 'android') {
                                JSBridge.call(UI, 'hideLoading', {})
                                JSBridge.call(UI, 'showToast', {title: '审核成功'})
                                this.isGo = true;
                                JSBridge.call(ROUTER, 'navigateBack', {backRefresh: true})
                            } else {
                                //微信
                                alert("审核成功");
                                this.isGo = true;
                                refresh();
                            }
                        });
                    },false,true);
                }
            },
            convertAuditFlagToName: function (auditFlag) {
                //auditFlag:-1,0,1,2,3,4,5,6
                switch (auditFlag) {
                    case -1:
                        return "未提交";
                        break;
                    case 0:
                        return "待审核";
                        break;
                    case 1:
                        return "已通过";
                        break;
                    case 2:
                        return "已驳回";
                        break;
                    default :
                        break;
                }
            },
            changes: function () {

            },
            look: function (url) {
                var that = this
                var param = {
                    url: url
                }
                if (getUrlParamObj().platform == 'android') {
                    JSBridge.call(FILE, 'showFile', param)
                }
            },
            /*重新编辑*/
            reEdit: function () {
                var that = this;
                JSBridge.call(ROUTER, 'navigateBack', {backRefresh: false})
                JSBridge.call(ROUTER, 'navigateTo', {url: '/page/apply/tmpevent/createEventApp.html?id=' + that.tmpEvent.main.id})
            },
            getById: function () {
                if (getUrlParamObj().platform == 'android') {
                    JSBridge.call(UI, 'showLoading', {})
                }
                var that = this;
                $.wyui.postMethod('/event/getById.json', {id: getUrlParamObj().id}, function (data) {
                    console.log(data);
                    if (getUrlParamObj().platform == 'android') {
                        JSBridge.call(UI, 'hideLoading')
                    }
                    //如果当前用户是审核人之一
                    for (var i = 0; i < data.auditors.length; i++) {
                        if (
                            data.auditors[i].auditFlag == '0' && data.auditors[i].auditorId == that.userId) {
                            that.showAuditReturnBtn = true;
                        }
                    }
                    var params = {moduleId: data.main.id};
                    commonService.getAttachesByModuleId(params, function (attaches) {
                        if (attaches) {
                            data.attaches = attaches;
                        }

                        that.tmpEvent = data;
                        that.tmpEvent.main.orgName = that.tmpEvent.main.orgName.split('-')[1];

                        var now = that.tmpEvent.main.createTime;
                        var d = new Date(now);
                        var hour = d.getHours();
                        var minute = d.getMinutes();
                        var month = d.getMonth() + 1
                        var day = d.getDate();
                        if (hour < 10) {
                            hour = "0" + hour;
                        }
                        if (minute < 10) {
                            minute = "0" + minute;
                        }
                        now =  month + "月" + day + "日" + " " + hour + ":" + minute;
                        that.tmpEvent.main.createTime = now;

                        for (var i = 0; i < data.auditors.length; i++) {
                            if (data.auditors[i].auditorName.indexOf("-") > -1) {
                                data.auditors[i].auditorName = data.auditors[i].auditorName.split('-')[0];
                            } else {
                                data.auditors[i].auditorName = data.auditors[i].auditorName;
                            }

                        }
                        if (that.tmpEvent.main.currentAuditorId == that.userId) {
                            that.pageType = "applyAudit";
                        } else {
                            that.pageType = '';
                        }
                    });
                });
            },
            getUserInfo:function () {
                $.wyui.postMethod(urlConfig.system.user.getUserViewById, {
                    id: getUrlParamObj().userId,
                }, function (result) {
                    console.log(result)
                    this.userInfo = result;
                });
            }

        },
        mounted: function () {
            this.userId = getUrlParamObj().currentAuditorId
            if (!this.userId) {
                this.userId = getUrlParamObj().userId
            }
            $.wyui.postMethod(urlConfig.system.message.setMessageReadFlag,
                {
                    receiverUserId: this.userId,
                    openUrl: '/page/apply/tmpevent/detail.html?id=' + getUrlParamObj().id,
                    flag: '1'
                },
                function (r) {
                    console.log(r)
                }
            );
            //上传附件
            var that = this;
            this.uploader = WebUploader.create({
                // 选完文件后，是否自动上传。
                auto: true,
                // swf文件路径
                swf: "/statics/plugin/webuploader-0.1.5/Uploader.swf",
                // 文件接收服务端。
                server: server.fjIp + "/attach/uploadFile.json",
                // 选择文件的按钮。可选。
                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                pick: '#divUpload',
                duplicate: true
            });
            this.uploader.on("uploadStart", function () {
                $("#progress").show();
            });
            this.uploader.on("uploadComplete", function () {
                $("#progress").hide();
            });
            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
            this.uploader.on('uploadSuccess', function (file, response) {
                if (response._raw == "文件上传出错！") {
                    alert("文件上传出错！");
                } else {
                    that.tmpEvent.attaches.push({
                        id: response.id,
                        name: response.name,
                        url: response.url
                    });
                }
            });
            // 文件上传失败，显示上传出错。
            this.uploader.on('uploadError', function (file) {
                alert("上传失败！");
            });
            this.getById();
            this.getUserInfo();
        }
    });
</script>
</body>
</html>